<include file="__THEME__/header" />
<script type="text/javascript" src="./public/js/xheditor-1.1.12/xheditor.js"></script>

<div class="content"><!-- 内容 begin  -->   
  
    <div class="mainbox">
     <form id="form1" name="form1" method="post" action="{:U('home/Myqiugou/dochekall')}" enctype="multipart/form-data" onsubmit="return docheckAll()">
      <div class="mainbox_R"> 
          
        <div class="right_box">
          <ul class="topic_list" rel="followTopicArea">
          <php>if(ACTION_NAME=='add'){</php>
               <li><h2>城市:</h2></li>
              <li> 
			 <script>ui.getarea('area','',{$userinfo.province},{$userinfo.city});</script>
							  
		       </li>
               <li><h2>学校:</h2></li>
              <li> <input type="text" name="school" id="selectschool"   value="{$userinfo['school']}" class="text" readonly/>
              <input type="button" class="btn_b" value="选择学校" onclick="selectSchool()" />
                     <input type="hidden" id="current" name="areaid" value="{$userInfo.araeid}" />
              </li>
              <php>}else{</php>
               <li><h2>城市:</h2></li>
              <li>  <script>ui.getarea('area','',{$goods.province},{$goods.city});</script></li>
               <li><h2>学校:</h2></li>
              <li> <input type="text" name="school" id="selectschool"   value="{$goods['school']}" class="text" readonly/>
              <input type="button" class="btn_b" value="选择学校" onclick="selectSchool()" />
                     <input type="hidden" id="current" name="areaid" value="{$userInfo.araeid}" /></li>
              <php>}</php>
          </ul>
        </div>
      </div>
      <div class="mainbox_CR">
      <div style="overflow:hidden;">
      
            <div class="tab-menu"><!-- 切换标签 begin  -->
              <ul>
                <li><a id="feed_colleague_item" rel="colleague" class="feed_item" href="{:U('home/Myqiugou/index')}"><span>求购信息列表</span></a></li>
				
                <li><equal name="ACTION_NAME" value="edit" ><a id="feed_all_item" rel="all" class="on feed_item" href="{:U('home/Myshop/add')}"><span>编辑求购</span></a>
                <else/><a id="feed_all_item" rel="all" class="on feed_item" href="{:U('home/Myqiugou/add')}"><span>发布新求购</span></a></equal></li>
              
              </ul>
            </div>
        </div>
       
        <div class="feedBox">

 <input  type="hidden" name="id" value="{$goods[id]}"/>
 <ul class="feed_list">
   <li><div class="f16px">标 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;题：
    <input  type="text" name="title" id="g_title" value="{$goods[title]}" class="title35"  onfocus="this.className='title35on'" onblur="this.className='title35'"/></div></li>
     <li><div class="f16px"> 商品名称：
   <input  type="text" name="name" id="g_name" value="{$goods[gname]}" class="text35"  onfocus="this.className='text35on'" onblur="this.className='text35'" /></div></li>
     <li><div class="f16px"> 商品数量：
     <input  type="text" name="number" id="g_number" value="{$goods[gnumber]}"  class="text35"  onfocus="this.className='text35on'" onblur="this.className='text35'" /></div></li>
    <li> <div class="f16px">商品单价：
     <input  type="text" name="price" id="g_price" value="{$goods[gprice]}"  class="text35"  onfocus="this.className='text35on'" onblur="this.className='text35'" /></div></li>
    <li> <div class="f16px"> 商品类型：
     <select name="type" id="type" class="text35" onfocus="this.className='text35on'" onblur="this.className='text35'" >
     <volist name="goodstype" id="type">
     <option <eq name="type.type_id" value="$goods['gtype']" >selected</eq> value="{$type[type_id]}">{$type['title']}</option>
     </volist>
     </select></div></li>
   
   <div>
     <php>if ($goods[gimage]) {</php>
    <img src="__UPLOAD__/goods/s_{$goods[gimage]}"><php>}</php>
    </div>
    <br/> </ul>
   <div class="f16px">商品详细：</div>
    
    <div> <textarea name="g_details"  id="g_details" style="width:700px;height:350px">{$goods['gdetails']}</textarea></div>
 <br/>
     <input type="submit" name="button" id="button" value="  " class="btn_big"  style="margin:2px 5px 0 0;" onclick="docheckall()"/>


        </div>
      </div>
       </form>
    </div>
  
</div>
 
<!-- 内容 end --> 

 <script>
 <!-- 在线编辑器 bigen-->
$(document).ready(function(){
var plugins={
	Code:{c:'btnCode',t:'插入代码',h:1,e:function(){
		var _this=this;
		var htmlCode='<div>插入代码</div><div><textarea id="xheCodeValue" wrap="soft" spellcheck="false" style="width:300px;height:100px;" /></div><div style="text-align:right;"><input type="button" id="xheSave" value="确定" /></div>';			var jCode=$(htmlCode),jType=$('#xheCodeType',jCode),jValue=$('#xheCodeValue',jCode),jSave=$('#xheSave',jCode);
		jSave.click(function(){
			_this.loadBookmark();
			_this.pasteHTML("<p class=\"code\" >" + jValue.val() + "</p><br />");
			_this.hidePanel();
			return false;
		});
		_this.showDialog(jCode);
	}}
}
var description=$('#g_details').xheditor({plugins:plugins,loadCSS:'<style>body  {font-family:"Arial", "Verdana";font-size:12px;margin: 0;}.code{margin: 5px 0;padding: 10px;text-align: left;display: block;overflow: auto;font-size:20px;background: #FAFAFA;border: 1px solid #f2f2f2;font: 500 1em/1.5em "Lucida Console", "courier new", monospace ;}</style>',tools:'Bold,Italic,Underline,Strikethrough,|,List,Emot,Preview,btnCode,Fullscreen,Source',skin:'default',upLinkUrl:'{:U('home/Attach/xheditor')}',upImgUrl:'{:U('home/Attach/xheditor')}',upFlashUrl:'{:U('home/Attach/xheditor')}',upFlashExt:'swf,flv',upMediaUrl:'{:U('home/Attach/xheditor')}',html5Upload:false});
});
<!-- 在线编辑器 end-->
function selectSchool(){
    var typevalue = $("#current").val();
    ui.box.load(U('home/School/school')+'&selected='+typevalue,{title:'选择所在学校'});
}
</script> 

<script>
function docheckAll(){
	var g_title=$("#g_title").val();
	var g_name=$("#g_name").val();
	var g_price=$("#g_price").val();
	var g_number=$("#g_number").val();
	var g_details=$("#g_details").val();
	var g_school=$("#selectschool").val();
  if(g_title==''){
	 ui.error('请输入标题');
	 return false;
  }else if(g_title.length > 30){
	 ui.error('标题不能超过30字');
	 return false;
  }else if(g_name==''){
	 ui.error('请输入商品名称');
	 return false;
  }else if(g_number==''){
	 ui.error('请输入数量');
	 return false;
  }else if(g_price==''){
	 ui.error('请输入价格');
	 return false;
  }else if(g_details==''){
	 ui.error('请输入详细信息');
	 return false;
  }else if(g_details.length > 1500){
	  
	  ui.error('详细信息不能超过1500字');
	  return false;
  }	else if(g_school==''){
	 ui.error('选择学校');
	 return false;
  }			
	
}
</script>

<include file="__THEME__/footer" /> 